import * as vscode from 'vscode'
import { AgentWebviewProvider } from './AgentWebviewProvider'

export function activate(context: vscode.ExtensionContext) {
	// 注册webview
	const webViewProvider = new AgentWebviewProvider(context)
	context.subscriptions.push(
		vscode.window.registerWebviewViewProvider(
			"code-agent.SidebarProvider",
			webViewProvider
		)
	)
	// 注册发送信息给前端的命令
	context.subscriptions.push(
		vscode.commands.registerCommand(
			"code-agent.sendInfo",
			() => {
				// 调用 webview 实现的传递信息的方法
				webViewProvider.postMessage("hello world")
			}
		)
	)
}

export function deactivate() { }
